package com.yeyouluo.partition;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class CustomPartition extends Partitioner<Text, PartitionBean> {
    @Override
    public int getPartition(Text text, PartitionBean partitionBean, int numPartitions) {
        String key = text.toString();
        switch (key) {
            case "kar":
                return 0;
            case "pandora":
                return 1;
            default:
                return 2;
        }
    }
}
